Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement AEIP2 update #580

Merged

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented Sep 20, 2022

Description

Implementation of the new version of AEIP2 (archethic-foundation/aeip@71d6e4f)

Fixes archethic-foundation/aeip#4 / archethic-foundation/aeip#9

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Update test files
Creation of multiple NFT with or without collection, id, properties ...

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Member

@samuelmanzanera samuelmanzanera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might also change a bit the explorer to display—based on the decimals—the number of tokens received.

lib/archethic/mining/fee.ex Show resolved Hide resolved
@Neylix
Copy link
Member Author

Neylix commented Sep 22, 2022

We might also change a bit the explorer to display—based on the decimals—the number of tokens received.

Updated explorer UI to handle decimals, and display token symbol instead of address

Also fixed bug of #560

@Neylix Neylix mentioned this pull request Sep 22, 2022
@Neylix Neylix linked an issue Sep 22, 2022 that may be closed by this pull request
uco_price_at_time = tx.validation_stamp.timestamp |> OracleChain.get_uco_price()
uco_price_now = DateTime.utc_now() |> OracleChain.get_uco_price()

tokens =
Copy link
Member

@samuelmanzanera samuelmanzanera Sep 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to reduce lines and avoid repetition you could use recursive function:

token_properties = []
 |> get_token_addresses(ledger_inputs)
 |> get_token_addresses(transaction_movements)
 |> get_token_addresses(token_transfers)
 |> Enum.uniq()
 |> get_token_properties()

# ...

defp get_token_addresses(acc, [ %TransactionMovement{ type: {:token, token_address, _}} | rest ]) do
    get_token_addresses([ token_address | acc ], rest)
end

defp get_token_addresses(acc, [ %TransactionInput{ type: {:token, token_address, _}} | rest]) do
    get_token_addresses([ token_address | acc ], rest)
end

defp get_token_addresses(acc, [ %TokenTransfer{ token_address: token_address } | rest ]) do
    get_token_addresses([ token_address | acc ], rest)
end

defp get_token_addresses(acc, _) do
    get_token_addresses(acc, rest)
end

defp get_token_addresses(acc, []) do, do: acc

@samuelmanzanera samuelmanzanera merged commit e8c0f09 into archethic-foundation:develop Sep 22, 2022
@Neylix Neylix deleted the Implement-AEIP2-update branch September 23, 2022 07:50
@samuelmanzanera samuelmanzanera added the feature New feature request label Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explorer Inputs misplaced
2 participants